import java.io.*;
import java.net.*;
import java.util.*;
import java.sql.*;


public class UserServer implements Runnable{

    private ServerSocket server;
    private BufferedWriter writer;
    private BufferedReader input;
    private Encryption enc;


    public UserServer(int port){

        try{
            enc = new Encryption();
            server = new ServerSocket(port);
            System.out.println("Server created");
        }catch(Exception e){e.printStackTrace();}

    }

    public void run(){
        
        try{ 

            while(true){
                Socket socket = this.server.accept();
                System.out.println("--> AVISO: Um usuario se conectou");
                UserServerThread ust = new UserServerThread(socket);
                ust.start();
            }

        }catch(Exception e){e.printStackTrace();}
    }
}
